<template>
<div class="user">
    <el-form ref="form" :model="form" label-width="150px">
      <!--添加门店-->
      <div class="common-form">{{$t('plus.free_shipping_setting')}}</div>
      <el-form-item :label="$t('plus.enable_free_shipping')">
        <el-radio-group v-model="form.status">
          <el-radio :label="0">{{$t('plus.off')}}</el-radio>
          <el-radio :label="1">{{$t('plus.on')}}</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item :label="$t('plus.order_amount_reach')">
        <div style="width: 500px;">
          <el-input :placeholder="$t('plus.input_amount')" v-model="input2">
            <template #append>{{$t('plus.unit_yuan')}}</template>
          </el-input>
          <p>{{$t('plus.free_shipping_tip')}}</p>
        </div>
      </el-form-item>
      <el-form-item :label="$t('plus.excluded_products')">
        <el-button type="primary">{{$t('plus.select_product2')}}</el-button>
      </el-form-item>
      <el-form-item :label="$t('plus.excluded_regions')">
        <el-button type="primary">{{$t('plus.select_region')}}</el-button>
      </el-form-item>
      <!--提交-->

      <el-form-item>
        <el-button type="primary" @click="onSubmit">{{$t('plus.submit')}}</el-button>
      </el-form-item>

    </el-form>
  </div>
</template>

<script>
import PushApi from '@/api/push.js';
export default {
  data() {
    return {
      form: {
        status: 0
      }
    };
  },
  methods: {
    onSubmit() {
      let self = this;
      let params = this.form;
      PushApi.shipping(params, true).then(data => {
        if (data.code == 1) {
          ElMessage({
            message: $t("plus.add_success"),
            type: 'success'
          });
          self.$router.push('/plus/article/Index');
        } else {
          ElMessage.error($t("plus.error_message_sample"));
        }
      }).catch(error => {});
    }
  }
};
</script>

